/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package csc668868webappteamsp12aproject1;

import java.util.ArrayList;


/**
 *
 * @author Jeff
 */
public class Transaction {
    private String name;
    private ArrayList<LineItem> itemlist;
    private Payment outlay;
    private String timestamp;
    
/**
 *  Construct a new Transaction
 */
    public Transaction() {
        name = "";
        itemlist = new ArrayList<LineItem>();
        outlay = new Payment();
        timestamp = "";
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String newName) {
        name = newName;
    }

    public ArrayList<LineItem> getItemlist() {
        return itemlist;
    }
    
    public void addLineItem(LineItem newLineItem) {
        itemlist.add(newLineItem);
    }

    public Payment getPayment(){
        return outlay;
    }

    public void setPayment(Payment newPayment) {
        outlay = newPayment;
    }
    
    public String getTimestamp() {
        return timestamp;
    }
    
    public void setTimestamp(String newTimestamp) {
        timestamp = newTimestamp;
    }    
    
    public void print() {
        System.out.println("name: " + name);
        int numItems = itemlist.size();
        for(int i=0; i<numItems; i++) {
            LineItem temp = itemlist.get(i);
            temp.print();
        }
        outlay.print();
        System.out.println("timestamp: " + timestamp);
    }
}
